package com.vpx.server.framework.authority;

import com.vpx.server.bean.entity.SysRoleAuth;
import com.vpx.server.framework.base.Base;
import com.vpx.server.framework.base.SessionContext;
import lombok.Getter;
import lombok.Setter;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author lihui
 * @title: vpx
 * @module system
 * @description: session信息
 * @date 2021/9/11 16:33
 */
@Getter
@Setter
public class SessionInfo extends Base {
    /**
     * 设置clear为0时，将清空redis的数据
     */
    private int clear = 1;

    private String sid;

    private String lastTime;

    private String createtime;

    private Map<String, Object> serviceSession = new ConcurrentHashMap<String, Object>();

    public void putSessionUser(SessionUser sessionUser){
        serviceSession.put(SessionContext.SESSION_USER_KEY, sessionUser);
    }

    public SessionUser getSessionUser(){
        return (SessionUser)serviceSession.get(SessionContext.SESSION_USER_KEY);
    }

    public Object getAttribute(String key){

        return serviceSession.get(key);
    }

    public void setAttribute(String key, Object obj){

        serviceSession.put(key, obj);
    }



}
